LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Source for file config.inc.php

Documentation is available at config.inc.php

  1. <?php
  2. require_once 'LiveUser/Admin.php';
  3. // Please configure the following file according to your environment
  4.  
  5. $GLOBALS['_LIVEUSER_DEBUG'= true;
  6.  
  7. $db_user 'root';
  8. $db_pass '';
  9. $db_host 'localhost';
  10. $db_name 'liveuser_admin_test_example1';
  11.  
  12. $dsn = "mysql://$db_user:$db_pass@$db_host/$db_name";
  13.  
  14. $backends = array(
  15.     'DB' => array(
  16.         'options' => array()
  17.     )
  18.     'MDB' => array(
  19.         'options' => array()
  20.     ),
  21.     'MDB2' => array(
  22.         'options' => array(
  23.             'debug' => true,
  24.             'debug_handler' => 'echoQuery',
  25.         )
  26.     )
  27. );
  28.  
  29. if (!isset($_GET['perm'])) {
  30.     $perm 'MDB2';
  31. elseif (isset($backends[$_GET['perm']])) {
  32.     $perm strtoupper($_GET['perm']);
  33. else {
  34.     exit('Perm Backend not found.');
  35. }
  36.  
  37. require_once $perm.'.php';
  38.  
  39. function echoQuery(&$db$scope$message)
  40. {
  41.     Var_Dump::display($scope.': '.$message);
  42. }
  43.  
  44. $dummy = new $perm;
  45. $db $dummy->connect($dsn$backends[$perm]['options']);
  46.  
  47. if (PEAR::isError($db)) {
  48.     echo $db->getMessage(' ' $db->getUserInfo();
  49.     die();
  50. }
  51.  
  52. $db->setFetchMode($perm.'_FETCHMODE_ASSOC');
  53.  
  54. $conf =
  55.     array(
  56.         'autoInit' => false,
  57.         'session'  => array(
  58.             'name'     => 'PHPSESSION',
  59.             'varname'  => 'ludata'
  60.         ),
  61.         'login' => array(
  62.             'force'    => false,
  63.         ),
  64.         'logout' => array(
  65.             'destroy'  => true,
  66.         ),
  67.         'authContainers' => array(
  68.             array(
  69.                 'type'          => 'DB',
  70.                 'name'          => 'DB_Local',
  71.                 'loginTimeout'  => 0,
  72.                 'expireTime'    => 3600,
  73.                 'idleTime'      => 1800,
  74.                 'dsn'           => $dsn,
  75.                 'allowDuplicateHandles' => false,
  76.                 'authTable'     => 'liveuser_users',
  77.                     'authTableCols' => array(
  78.                         'required' => array(
  79.                             'auth_user_id' => array('type' => 'text',   'name' => 'auth_user_id'),
  80.                             'handle'       => array('type' => 'text',   'name' => 'handle'),
  81.                             'passwd'       => array('type' => 'text',   'name' => 'passwd'),
  82.                         ),
  83.                         'optional' => array(
  84.                             'is_active'      => array('type' => 'boolean''name' => 'is_active'),
  85.                             'lastlogin'      => array('type' => 'timestamp''name' => 'lastlogin'),
  86.                             'owner_user_id'  => array('type' => 'integer',   'name' => 'owner_user_id'),
  87.                             'owner_group_id' => array('type' => 'integer',   'name' => 'owner_group_id')
  88.                         ),
  89.                         'custom' => array (
  90.                             'name'  => array('type' => 'text',    'name' => 'name'),
  91.                             'email' => array('type' => 'text',    'name' => 'email'),
  92.                         )
  93.                     )
  94.             )
  95.         ),
  96.         'permContainer' => array(
  97.             'type'  => 'Complex',
  98.             'alias' => array(),
  99.             'storage' => array(
  100.                 $perm => array(
  101.                     'connection' => $db,
  102.                     'dsn' => $dsn,
  103.                     'prefix' => 'liveuser_',
  104.                     'tables' => array(),
  105.                     'fields' => array(),
  106.                     'alias' => array(),
  107.                     // 'force_seq' => false
  108.                 ),
  109.             ),
  110.         ),
  111.     );
  112.  
  113. $admin =LiveUser_Admin::factory($conf);
  114. $logconf = array('mode' => 0666'timeFormat' => '%X %x');
  115. $logger &Log::factory('file''liveuser_test.log''ident'$logconf);
  116. $admin->addErrorLog($logger);
  117. $admin->setAdminContainers();

Documentation generated on Mon, 11 Mar 2019 14:31:04 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.